package com.ja.openchat.viewmodels;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.blankj.utilcode.util.ToastUtils;
import com.zy.openchat.core.model.user.UserInfo;
import com.ja.openchat.data.entity.ImageEntity;

import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;


public class GoChatCirclePublishImageAtViewModel extends MultiItemViewModel<GoChatCirclePublishViewModel> {
    public ObservableField<ImageEntity> entity = new ObservableField<>();

    public ObservableField<UserInfo> userAvatar = new ObservableField<>(UserInfo.getUserInfo());
    public GoChatCirclePublishImageAtViewModel(@NonNull GoChatCirclePublishViewModel application, ImageEntity entity) {
        super(application);
        this.entity.set(entity);
    }

    //条目的点击事件
    public BindingCommand itemClick = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            //拿到position
            int position = viewModel.observableListAt.indexOf(GoChatCirclePublishImageAtViewModel.this);
            ToastUtils.showShort("position：" + position);
        }
    });
}
